package com.saobao.m.assistant.dao

import com.saobao.m.assistant.domain.UserDO
import org.apache.ibatis.annotations.Insert
import org.apache.ibatis.annotations.Select
import org.apache.ibatis.annotations.SelectKey

/**
 * @author sunruifeng
 * @since 15/2/3 下午12:00
 */
public interface UserDAO {
    @Insert('''
        insert into user(name,age,sex) values(#{name},#{age},#{sex})
    ''')
    @SelectKey(statement = "select LAST_INSERT_ID() AS ID",
            resultType = Long.class,
            keyProperty = "id",
            before = false)
    int insert(UserDO user);

    @Select('''
        select * from user;
    ''')
    List<UserDO> listAll();
}
